<?php
function get_array($id=0){
    global $arr;
    $sql="select id,name from tree WHERE pid=$id";
    $result=mysqli_querry($sql);//查询pid中的子类
    $arr=array();
    if($result&&mysqli_affected_rows()){    //如果存在子类
          while($rows=mysqli_affected_rows()){
              $rows ['list']=get_array($rows['$id']);
              $arr[]=$rows;
        }
        return $arr;
    }
}
?>

